{if $actu->ao_actu_bon_plan=='0'} {assign $non = "CHECKED"}{else}{assign $non = ""}{/if}
{if $actu->ao_actu_bon_plan=='1'} {assign $oui = "CHECKED"}{else}{assign $oui = ""}{/if}

{assign $pathImageActu = ACTU_PATH_PHOTO}

<div id="main_container">

	{$oZoneHeader}
    
    <div class="main_content">
        {$oZoneTopMenu}
        <div class="center_content">  
            <div class="left_content">
                {$oZoneLeftMenu}
                {if $idCat}
                    <h4>Les actualités : </h4> 
                        
                    <table style="width:195px" id="rounded-corner" summary="2007 Major IT Companies' Profit">
                            {foreach $actuByCategorie as $item}
                            <tr>
                                <td><a href="{jurl 'actu~BoActu:index', array('id'=>$item->ao_actu_id)}">{$item->ao_actu_name}</a></td>
                            </tr>
                            {/foreach}
                    </table>
                {/if}
            </div>
    
            <div class="right_content">
                    {if $actu->ao_actu_id}
                        <h2>Editer une actualité</h2> 
                    {else}
                        <h2>Ajouter une actualité</h2> 
                    {/if}
                    
                <form action="{jurl 'actu~BoActu:sauvegarder'}" method="post" id="editActu" name="editActu" enctype="multipart/form-data">
                    <input type="hidden" name="id" value="{$actu->ao_actu_id}" />
                    <dl>
                		<dt><label>Catégorie *: </label></dt>
                 		<dd>
                            <select name="categorie">
                                {foreach $cat as $catItem}
                                    {if $catItem->ao_cat_id == $actu->ao_actu_categorie_id}
                                        {assign $selected = "selected='selected'"}
                                    {else}
                                        {assign $selected = ""}
                                    {/if}
                                    <option value="{$catItem->ao_cat_id}" {$selected}>{$catItem->ao_cat_name}</option>
                                {/foreach}
                            </select>
                        </dd>
              		</dl>
                    <dl>
                		<dt><label>Titre *: </label></dt>
                 		<dd><input type="text" name="actu_titre" value="{$actu->ao_actu_name}" validation="required"/></dd>
              		</dl>
                    <dl style="height:auto">
                        <dt><label>Texte *: </label></dt>
                            <dd style="width:600px;">
                            <textarea id="content" name="content" validation="required">{$actu->ao_actu_content}</textarea>
                            <script type="text/javascript">
                                {literal}CKEDITOR.replace( 'content', {width:'600px', toolbar:'AOToolbar'}) ;{/literal}
                            </script>
                        </dd>
                    </dl>
                    <dl>
                		<dt><label>Mots clés *: </label></dt>
                 		<dd>
                            <select name="motcle">
                                {foreach $motcle as $motcleItem}
                                    {if $motcleItem->ao_motcle_id == $actu->ao_actu_mot_cle_id}
                                        {assign $selected = "selected='selected'"}
                                    {else}
                                        {assign $selected = ""}
                                    {/if}
                                    <option value="{$motcleItem->ao_motcle_id}" {$selected}>{$motcleItem->ao_motcle_name}</option>
                                {/foreach}
                            </select>
                        </dd>
              		</dl>
                    <dl>
                		<dt><label>Date *: </label></dt>
                 		<dd><input type="text" id="datepicker" name="actu_date" value="{$actu->ao_actu_date|jdatetime:'db_date':'lang_date'}" validation="required"/></dd>
              		</dl>
                    <dl>
                		<dt><label>Priorité *: </label></dt>
                 		<dd>
                            <select name="priority">
                                {for $i=1; $i<=3; $i++}
                                    {if $i == $actu->ao_actu_priority}
                                        {assign $selected = "selected='selected'"}
                                    {else}
                                        {assign $selected = ""}
                                    {/if}
                                    <option value="{$i}" {$selected}>{$i}</option>
                                {/for}
                            </select>
                        </dd>
              		</dl>
                     
                    <dl>
                		<dt><label>Bon plan : </label></dt>
                 		<dd>
                            <input type="radio" name="bp" value="1" {$oui}/> Oui
                            <input type="radio" name="bp" value="0" {$non}/> Non
                        </dd>
              		</dl>
                    
                    <dl style="height:auto">
                		<dt><label>Photo 1 : </label></dt>
                 		<dd><input type="file" name="photo1" value="{$actu->ao_actu_photo_1}" /></dd>
                        
              		</dl>
                    {if $actu->ao_actu_id && $actu->ao_actu_photo_1}
                 		    <img src="{$pathImageActu}{$actu->ao_actu_photo_1}" alt="{$actu->ao_actu_name}" width="90" height="60" style="margin-left:155px;"/>
                    {/if}
                    <dl style="height:auto">
                		<dt><label>Photo 2 : </label></dt>
                 		<dd><input type="file" name="photo2" value="{$actu->ao_actu_photo_2}" /></dd>
                        
              		</dl>
                    {if $actu->ao_actu_id && $actu->ao_actu_photo_2}
                 		    <img src="{$pathImageActu}{$actu->ao_actu_photo_2}" alt="{$actu->ao_actu_name}" width="90" height="60" style="margin-left:155px;"/>
                    {/if}
                    <dl style="height:auto">
                		<dt><label>Photo 3 : </label></dt>
                 		<dd><input type="file" name="photo3" value="{$actu->ao_actu_photo_3}" /></dd>
                        
              		</dl>
                    {if $actu->ao_actu_id && $actu->ao_actu_photo_3}
                 		    <img src="{$pathImageActu}{$actu->ao_actu_photo_3}" alt="{$actu->ao_actu_name}" width="90" height="60" style="margin-left:155px;"/>
                    {/if}
                    <dl class="submit">
                        <input style="margin-right:10px;"  class="valider" title="Valider" type="submit" value="" />
                 		<a title="Annuler" href="{jurl 'actu~BoActu:index'}" class="bt_green"><span class="bt_green_lft"></span><strong>Annuler</strong><span class="bt_green_r"></span></a>
                    </dl>
                  
                 </form>

            </div><!-- end of right content-->
        </div>   <!--end of center content -->

        <div class="clear"></div>
    </div> <!--end of main content-->
    <div class="footer">
    </div>
</div>

{literal}
   
    <script type="text/javascript">
       
        $( "#datepicker" ).datepicker({dateFormat: 'dd/mm/yy'});
        // form validation
        var demoForm = $("#editActu");
        demoForm.validation();
        demoForm.submit(function(e) {

            $("#valid-form").remove();
            if(demoForm.validate()) {
                document.forms["editActu"].submit();
            }
            e.preventDefault();
        });
    </script>
{/literal}
